package com.udi.project.business.utils.excel.utils;

import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;

/**
 * @author Admin
 *  自定义消息
 */
@Component
public class Message  {


    private String msg;
    private String code;

    /**
     *
     * @Description: 写入成功消息
     * @param msg 成功消息
     * @return: java.lang.String
     */
    public JSONObject SuccessMessage(String msg){
        String talk = "{\"msg\":\"" + msg + "\",\"code\":\"200\"}";
        return JSONObject.parseObject(talk);
    }

    /**
     *
     * @Description: 写入失败消息
     * @param msg 失败消息
     * @return: java.lang.String
     */
    public JSONObject errorlMessage(String msg){
        String talk ="{\"msg\":\"" + msg + "\",\"code\":\"500\"}";
        return JSONObject.parseObject(talk);
    }


    @Override
    public String toString(){
        return "{" +
                "\"msg\":\"" + msg + "\"" +
                ",\"code\":\"" + code + "\"" +
                '}';

    }

}
